#ifndef PLOT2D_DIALOG_H
#define PLOT2D_DIALOG_H

#include <QtGui/QDialog>
#include<QColorDialog>
#include<QTextStream>
#include<QList>
#include<QModelIndex>
#include "ui_plot2d_dialog.h"
#include "var_def.h"
/*namespace Ui
{
    class Plot2D_Dialog;
}
*/
using namespace std;


class myGraph{
public:
    myGraph();
    ~myGraph();

    QString save();
    QString Datasetname;
    QString Freq;
    QString Selection_mode;
    QString Data_onX, Data_onY;
    int Source_impd, Load_impd;
    QString     yAxisNo;       // which y axis is used
    int     countY;    // number of curves
    QColor  Color;
    int     Thick;
    QString     Style;
    QString name;

    int  numMode;     // real/imag or polar (deg/rad)
};
class myAxis {
    public:
    double  min, max; // least and greatest values of all graph data
    double  low, up;  // the limits of the diagram
    bool    log;      // in "rectdiagram": logarithmic or linear
    QString Label;
    int     numGraphs;  // counts number of graphs using this axis
    bool    GridOn;

    bool   autoScale;    // manual limits or auto-scale ?
    double limit_min, limit_max, step;   // if not auto-scale
};

class Plot_2D_config{
public:
    int update_plot;
    QColor GridColor, BackGroundColor,Graph_Color;
    bool showgrid;
    QString gridlinetype;
    myGraph Graph1;
    myAxis  xAxis, ylAxis, yrAxis;   // axes (x, y left, y right)
};

 class Plot2D_DialogBase : public QDialog, protected Ui::Plot2D_Dialog
  {
  public:
    Plot2D_DialogBase(QWidget* parent = 0)
      : QDialog(parent)
    {
    }

private slots:
    void on_buttonBox_rejected();
};



class Plot2D_Dialog : public Plot2D_DialogBase
{
    Q_OBJECT

public:
    Plot2D_Dialog(Plot_2D_config *Plot2Dconfig,QList<Graph> *Plot2D_list_of_graph,QWidget *parent = 0);
    ~Plot2D_Dialog();

    void Load_Default();
    void Save_Default();

    QList<Graph> *list_of_graph;

private:
    //Ui::Plot2D_Dialog *ui_Plot2D_Dialog;
Plot_2D_config *config;

private slots:
    void on_buttonBox_rejected();
    void on_Graph_apply_clicked();
    void on_Graph_List_clicked(QModelIndex index);
    void on_Graph_delete_clicked();
    void on_Graph_add_clicked();
    void on_Graph_Color_clicked();
    void on_BackGround_Color_clicked();
    void on_buttonBox_accepted();
    void on_Grid_Color_clicked();
    void update_Graph_List_viewer();

};

#endif // PLOT2D_DIALOG_H
